﻿
using System;
using System.Collections.Specialized;
namespace Inovout.NumberGenerator
{
    public class DateFunction : NumberFunction
    {
        public DateFunction()
            : this(new string[] { supportedDateFormats[supportedDateFormats.Length-1] })
        {
        }
        public DateFunction(string[] arguments)
            : base("Date")
        {
            format = arguments[0];
        }

        private static string[] supportedDateFormats = new string[]{
            "yy",
            "yyyy",
            "yyyyM",
            "yyyyMM",
            "yyyyMd",
            "yyyyMMdd"
        }; 


        public string[] SupportedDateFormats
        {
            get { return supportedDateFormats; }
        }

        private string format;
        public string Format
        {
            get { return format; }
            set { format = value; }
        }
        public override string[] Arguments
        {
            get { return new string[]{format}; }
        }
        public override string Build()
        {
            return DateTime.Now.ToString(format);
        }
    }
}
